/*
 * @Author: your name
 * @Date: 2021-04-30 16:54:42
 * @LastEditTime: 2021-07-23 23:53:52
 * @LastEditors: your name
 * @Description: In User Settings Edit
 * @FilePath: \hairdressing_web\src\common\share.js
 */
let path = '/pages/index/index'
if (uni.getStorageSync('userId')) {
  path = path + '&userId=' + uni.getStorageSync('userId')
}
uni.setStorageSync('sharePage', path)

export default {
  data() {
    return {
      // 设置默认的分享参数
      share: {
        title: '爱丽雅小程序',
        path: uni.getStorageSync('sharePage'),
        imageUrl: '',
        desc: '爱丽雅小程序',
        content: '爱丽雅小程序'
      }
    }
  },
  onShareAppMessage(res) {
    return {
      title: this.share.title,
      path: this.share.path,
      imageUrl: this.share.imageUrl,
      desc: this.share.desc,
      content: this.share.content,
      success(res) {
        uni.showToast({
          title: '分享成功'
        })
      },
      fail(res) {
        uni.showToast({
          title: '分享失败',
          icon: 'none'
        })
      }
    }
  }
}
